home *** CD-ROM | disk | FTP | other *** search
/ Experimental BBS Explossion 3 / Experimental BBS Explossion III.iso / pascal / bp70lib.zip / GENERIC.DOC < prev    next >
Text File  |  1993-04-15  |  7KB  |  170 lines

  1. unit generic;
  2.  
  3.  
  4.  
  5. interface
  6.  
  7. uses dos,crt;
  8.  
  9.  
  10. var m:array[0..25] of string;     { used by menus and message boxes }
  11.  
  12.  
  13.  
  14. {############################## dos routines ##############################}
  15.  
  16. procedure formfeed;                                { sends formfeed to PRN }
  17. procedure chngdrv(c:char);                     { changes to drive c }
  18. function lastdrive:char;         { returns last drive installed on machine }
  19. procedure copyfile(s,s2:string);
  20.  { copies file s to s2. heap must be small enough for command.com to load. }
  21. function filefound(s:string):boolean;   { returns true if file s is found }
  22. procedure renamefile(s,ss:string);
  23.             { renames file s to ss. overwrites file ss if it already exists }
  24. procedure delfile(s:string);                            { deletes file s }
  25. procedure warmboot; { does a warm reboot (ctrl-alt-del). real mode only. }
  26. procedure coldboot; { does a cold reboot (reset button). real mode only. }
  27.  
  28.  
  29.  
  30.  
  31. {################################ sound routines ###########################}
  32.  
  33. procedure beep(i,j:integer);       { does a sound at freq i for j/1000 secs }
  34. procedure nogosound;                               { sound effect }
  35. procedure click1;                                  { sound effect }
  36. procedure click2;                                  { sound effect }
  37.  
  38.  
  39.  
  40. {############################# mouse routines ############################}
  41.  
  42. procedure sm;   { shows mouse. text thru vga vidmodes only. }
  43. procedure hm;   { hides mouse. text thru vga vidmodes only. }
  44. procedure resetmouse(setgrafmouse:boolean);
  45.                         { resets mouse. use resetmouse at program start &
  46.                           after switching between graphics & text modes.
  47.                           if setgrafmouse=true, sets mouse x and y bounds
  48.                           to getmaxx and getmaxy (for graphics mode). }
  49. procedure pause(doclick:boolean);  { waits until a mouse button is pressed.
  50.         if doclick is true, then does a click sound when button is pressed. }
  51. function hasmouse:boolean;           { returns true if machine has a mouse }
  52. function mousex:integer;                { returns current mouse x coord }
  53. function mousey:integer;                { returns current mouse y coord }
  54. function mousebutton:integer;
  55. {                returns current mouse button value.
  56.                       0 = no buttons pressed.
  57.                       1 = button 1 being pressed.
  58.                       2 = button 2 being pressed.
  59.                       3 = buttons 1 & 2 being pressed.
  60.                       4 = button 3 being pressed.
  61.                       5 = buttons 1 & 3 being pressed.
  62.                       6 = butons 2 & 3 being pressed.
  63.                       7 = buttons 1, 2, & 3 being pressed. }
  64. procedure putmouse(x,y:integer);       { puts mouse to mouse coords x,y }
  65. procedure getmouse(var x,y,b:integer);
  66.           { gets current mouse status. x=mousex, y=mousey, b=mousebutton. }
  67. procedure nobutton;       { waits until no mouse buttons are being pressed }
  68.  
  69.  
  70.  
  71.  
  72.  
  73.  
  74. {########################## conversion routines ############################}
  75.  
  76. function i2s(i:longint):string;    { converts integer or longint to string }
  77. function r2s(r:real):string;                 { converts a real to a string }
  78. function s2i(s:string):integer;               { converts string to integer }
  79. function noslash(s:string):string;
  80. { returns s without trailing backslash (except root dirs). s is a path or
  81.   dir name. }
  82. function slash(s:string):string;
  83.     { returns s with trailing backslash if needed. s is a path or dir name }
  84. procedure upit(var s:string);        { converts a string to uppercase }
  85. function s2r(s:string):real;                 { converts a string to a real }
  86.  
  87.  
  88.  
  89.  
  90.  
  91.  
  92.  
  93.  
  94. {############################### math routines ############################}
  95.  
  96. function isin(x,y,x1,y1,x2,y2:integer):boolean;
  97.          { returns true if point x,y is in the area x1,y1 (UL corner),
  98.            x2,y2 (LR corner). }
  99. procedure ulim2(var i:longint; j:longint);  { upper limits longint i to j }
  100. procedure llim2(var i:longint; j:longint);  { lower limit longint i to j }
  101. procedure llim(var i:integer; j:integer);
  102.                                     { lower limits i to j. if i<j then i:=j }
  103. procedure ulim(var i:integer; j:integer);
  104.                                     { upper limits i to j. if i>j then i:=j }
  105. function greaterof(i,j:integer):integer;  { returns the greater of i and j }
  106. function lesserof(i,j:integer):integer;   { returns the lesser of i and j }
  107. function inrng(i,lb,ub:integer):boolean; { returns true if lb<=i and i<=ub. }
  108. function dice(i:integer):integer;
  109.           { returns roll of an i sided die. use randomize at program start. }
  110.  
  111.  
  112.  
  113. {############################ joystick routines ###########################}
  114.  
  115. procedure getstick(var x,y,b1,b2:integer);
  116.           { gets current joystick status. x,y are stick cooords.
  117.             b1,b2 are buttons 1 & 2 status. }
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124. {############################ text routines ###############################}
  125.  
  126. procedure cursor(i:integer); { sets cursor. 0=off, 1=normal, 2=full block. }
  127. function iscolor:boolean;  { returns true if machine supports color text. }
  128. procedure box(x1,y1,x2,y2:integer);  { draws text box }
  129. procedure col(i,j:integer);                 { sets text colors to i on j }
  130. procedure cls(i,j:integer);  { does a col(i,j) and then clears text screen }
  131. procedure say(i,j:integer; s:string);
  132.                        { writes S at i,j (x,y) using current text colors }
  133. procedure fill(x1,y1,x2,y2,color:integer);        { fills text area }
  134. procedure fore(i:integer);                   { sets text foreground color }
  135. procedure bak(i:integer);                    { sets text background color }
  136. procedure center(i:integer; s:string);
  137.                 { writes s centered at row i in current text colors }
  138. function menu(i:integer):integer;
  139.          { does text menu. returns option # selected. uses global array m.
  140.            i is # of items in menu. m[0] is title. m[1] thru m[i] are
  141.            options. }
  142. procedure msg(i:integer);
  143.    { does text message box w/ pause. uses array m. i is # of lines in msg }
  144. function getstr(i:integer):string;
  145.    { does string input box.  uses array m. i is # of lines in prompt }
  146.  
  147.  
  148.  
  149.  
  150.  
  151. {################################ keyboard routines #######################}
  152.  
  153. function rshiftpressed:boolean;   { returns true if right shift is pressed }
  154. function lshiftpressed:boolean;   { returns true if left shift is pressed }
  155. function ctrlpressed:boolean;     { returns true if ctrl is pressed }
  156. function altpressed:boolean;      { returns true if alt is pressed }
  157. function scrolllockon:boolean;    { returns true if scroll lock is on }
  158. function numlockon:boolean;       { returns true if num lock is on }
  159. function capslockon:boolean;      { returns true if caps lock is on }
  160. function inserton:boolean;        { returns true if insert is on }
  161. procedure nokey;           { waits until no keyboard keys are being pressed }
  162.  
  163.  
  164.  
  165.  
  166.  
  167.  
  168. implementation
  169.  
  170.